package com.vova.test.es.starter;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@NoArgsConstructor
@Data
@Document(indexName = "item2", type = "docs")
public class Item {
    @Id
    private Long id;

    @Field(type = FieldType.Text)
    private String title; //标题

    @Field(type = FieldType.Keyword)
    private Integer category;// 分类

    @Field(type = FieldType.Double)
    private Double price; // 价格

    public Item(Long id, String title, Integer category, Double price) {
        this.id = id;
        this.title = title;
        this.category = category;
        this.price = price;
    }
}
